<script>
init({
  title: 'Table Classes',
  desc: 'Use `classes` option to set the table styles. The default `classes` is `\'table table-bordered table-hover\'`.',
  links: ['bootstrap-table.min.css'],
  scripts: ['bootstrap-table.min.js']
})
</script>

<script>
  const $table = $('#table')

  function mounted () {
    $table.bootstrapTable()

    $('.toolbar input').change(function () {
      const classes = []

      $('.toolbar input:checked').map(function () {
        classes.push($(this).next().text())
      })

      $table.bootstrapTable('refreshOptions', {
        classes: classes.join(' ')
      })
    })
  }
</script>

<template>
  <div class="toolbar">
    <div class="checkbox">
      <label>
        <input
          type="checkbox"
          checked
          disabled
        >
        <code>table</code>
      </label>
    </div>
    <div class="checkbox">
      <label>
        <input
          type="checkbox"
          checked
        >
        <code>table-bordered</code>
      </label>
    </div>
    <div class="checkbox">
      <label>
        <input
          type="checkbox"
          checked
        >
        <code>table-hover</code>
      </label>
    </div>
    <div class="checkbox">
      <label>
        <input type="checkbox">
        <code>table-striped</code>
      </label>
    </div>
    <div class="checkbox">
      <label>
        <input type="checkbox">
        <code>table-dark</code>
      </label>
    </div>
    <div class="checkbox">
      <label>
        <input type="checkbox">
        <code>table-sm</code>
      </label>
    </div>
  </div>

  <div class="checkbox">
    <label>
      <input type="checkbox">
      <code>table-borderless</code>
    </label>
  </div>

  <table
    id="table"
    data-url="json/data1.json"
  >
    <thead>
      <tr>
        <th data-field="id">
          Item ID
        </th>
        <th data-field="name">
          Item Name
        </th>
        <th data-field="price">
          Item Price
        </th>
      </tr>
    </thead>
  </table>
</template>

<style>
  .checkbox {
    float: left;
    margin-right: 15px;
  }
</style>
